//
//  SettingsViewController.swift
//  Wallet
//
//  Created by Julian on 2022/5/7.
//

import UIKit

class SettingsViewController: UITableViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.register(UITableViewCell.self, forCellReuseIdentifier: "currencyID")
    }
    
    @IBAction func finishClicked(_ sender: UIBarButtonItem) {
        self.navigationController?.dismiss(animated: true)
    }
}

extension SettingsViewController {
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        switch AppSettings.shared.currencyValue {
        case .USD:
            AppSettings.shared.currency.onNext(CurrencyType.HKD)
        case .HKD:
            AppSettings.shared.currency.onNext(CurrencyType.USD)
        }
    }
}
